﻿<EpiDashboard:GadgetBase x:Class="EpiDashboard.AberrationControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:EpiDashboard="clr-namespace:EpiDashboard"
    xmlns:toolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=Epi.DataVisualization.Toolkit"
    xmlns:Controls="clr-namespace:EpiDashboard.Controls"
    Style="{DynamicResource gadgetBaseStyle}">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Controls:ShadowRectangle x:Name="rectangleShadow"></Controls:ShadowRectangle>
        <Border Name="borderAll" Style="{DynamicResource mainGadgetBorder}" >

            <Grid x:Name="grdMain">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="6" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="6" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="6" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <Controls:GadgetHeaderPanel x:Name="headerPanel" Grid.Row="0" Text="Aberration Detection" />
                <Controls:GadgetMessagePanel Margin="5" x:Name="messagePanel" Grid.Row="2" Text="" />
                <Controls:GadgetDescriptionPanel Grid.Row="4" PanelMode="Collapsed" x:Name="descriptionPanel"></Controls:GadgetDescriptionPanel>

                <!--<TextBlock Grid.Row="6" x:Name="txtFilterString" Style="{DynamicResource filterStringText}" Visibility="Collapsed" >
                </TextBlock>-->

                <Controls:GadgetInfoPanel Grid.Row="4" Visibility="Collapsed" Margin="5" x:Name="infoPanel"></Controls:GadgetInfoPanel>

                <!--<StackPanel x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <StackPanel x:Name="pnlCharts" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                </StackPanel>-->
                <StackPanel Grid.Row="7" x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top"></StackPanel>

                <Controls:GadgetWaitPanel x:Name="waitPanel" Visibility="Collapsed" Grid.Row="1" Grid.RowSpan="6" Style="{DynamicResource gadgetWaitPanelStyle}" />

                <StackPanel Grid.Row="1" Grid.RowSpan="7" Margin="00,-15,-10,0"  HorizontalAlignment="Right" VerticalAlignment="Top" >
                    <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,10,0" >
                        <Rectangle Style="{DynamicResource rectangleConfigOuter}" />
                        <Rectangle Style="{DynamicResource rectangleConfigInner}" />

                        <Path x:Name="pathTriangle" 
                              Margin="0,-2,90,0"
                              Data="M 5 0 L 10 10 0 10 Z" Fill="{DynamicResource gadgetBackgroundBrush}" IsHitTestVisible="False" HorizontalAlignment="Right" VerticalAlignment="Top" Height="7" />

                        <StackPanel Orientation="Vertical" Margin="25, 10, 25, 25" HorizontalAlignment="Center" VerticalAlignment="Top" >
                                <TextBlock x:Name="tblockConfigTitle" HorizontalAlignment="Center" TextAlignment="Center" Text="Aberration Detection Properties" Margin="5" FontWeight="Bold" />
                                <TextBlock x:Name="tblockIndicator" HorizontalAlignment="Left" TextAlignment="Center" Text="Indicator (Optional):" Margin="0,5,0,0"  />
                                <ComboBox x:Name="cbxSyndrome" Width="180" HorizontalAlignment="Left" SelectedIndex="0" />
                                <TextBlock x:Name="tblockCount" HorizontalAlignment="Left" TextAlignment="Center" Text="Count (Optional):" Margin="0,5,0,0"  />
                                <ComboBox x:Name="cbxFieldWeight" Width="180" HorizontalAlignment="Left" SelectedIndex="0" />
                                <TextBlock x:Name="tblockDate" HorizontalAlignment="Left" TextAlignment="Center" Text="Date:" Margin="0,5,0,0"  />
                                <ComboBox x:Name="cbxDate" Width="180" HorizontalAlignment="Left" SelectedIndex="0" />
                                <TextBlock x:Name="tblockLagTimeDays" HorizontalAlignment="Left" TextAlignment="Center" Text="Lag time (days):" Margin="0,5,0,0"  />
                                <TextBox x:Name="txtLagTime" Grid.Column="2" Grid.Row="5" Width="30" HorizontalAlignment="Left" Text="7" Margin="0, 0, 0, 00" PreviewTextInput="NumberBox_PreviewTextInput" TextChanged="txtLagTime_TextChanged"></TextBox>
                                <TextBlock x:Name="tblockThresh" HorizontalAlignment="Left" TextAlignment="Center" Text="Threshold (Std. Deviations):" Margin="0,5,0,0"  />
                                <TextBox x:Name="txtDeviations" Grid.Column="2" Grid.Row="5" Width="30" HorizontalAlignment="Left" Text="3" Margin="0, 0, 0, 00" PreviewTextInput="NumberBox_PreviewTextInput" TextChanged="txtDeviations_TextChanged"></TextBox>

                            <Expander Margin="0, 5, 0, 0" x:Name="expanderAdvancedOptions" Header="Advanced options">                                
                                <StackPanel Orientation="Horizontal">
                                    <!--<StackPanel x:Name="panelAdvanced1" Visibility="Visible">                                        
                                        <TextBlock x:Name="tblockStrataVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Stratify by:" Margin="0,5,0,0"  />                                        
                                        <ListBox x:Name="lbxFieldStrata" Width="180" Height="120" SelectionMode="Extended" HorizontalAlignment="Left" />
                                    </StackPanel>-->

                                    <StackPanel Grid.Column="2" x:Name="panelAdvanced2" Visibility="Visible">
                                        <TextBlock x:Name="tblockTimePeriod" HorizontalAlignment="Left" Text="Process records this many days prior:" Margin="0,5,0,0"  />
                                        <TextBox x:Name="txtTimePeriod" Width="30" HorizontalAlignment="Left" Text="365" Margin="0, 0, 0, 00" PreviewTextInput="NumberBox_PreviewTextInput" TextChanged="txtTimePeriod_TextChanged"></TextBox>
                                    </StackPanel>

                                    <!--<StackPanel Grid.Column="4"  x:Name="panelAdvanced3" Visibility="Visible">
                                        <TextBlock x:Name="tblockOutputColumns" Margin="0,5,0,0" >Output columns to display:</TextBlock>
                                        <ListBox x:Name="lbxColumns" SelectionMode="Multiple" SelectionChanged="lbxColumns_SelectionChanged">

                                        </ListBox>
                                    </StackPanel>-->
                                </StackPanel>
                            </Expander>
                            
                            <Button x:Name="btnRun" Margin="0,15,0,0" Click="btnRun_Click">Run</Button>
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </Border>        
    </Grid>
</EpiDashboard:GadgetBase>
